<template>
  <div class="wrapper" ref='wrapper'>
      <div class="content">
          <slot></slot>
        </div>
  </div>
</template>

<script>
import  BScroll from "@better-scroll/core"
import Pullup from '@better-scroll/pull-up'
import ObserveDOM from '@better-scroll/observe-dom'
import ObserveImage from '@better-scroll/observe-image'
BScroll.use(Pullup)
BScroll.use(ObserveDOM)
BScroll.use(ObserveImage)
// import func from '../../../../vue-temp/vue-editor-bridge';
export default {
  components: {},
  props: {
    probeType:{
        type:Number,
        defalut:0
      },
    pullUpLoad:{
      type:Boolean,
      defalut:false
    }
    
  },
  data() {
    return {
        scroll:null
    };
  },
  watch: {},
  computed: {},
  methods: {
      scrollTo(x,y,time=1000) {
        this.scroll.scrollTo(0,0)
      }
      
,
      finishPullUP() {
        this.scroll.finishPullUp()
      }
      
  },
  created() {
      
  },
  mounted() {
      this.scroll=new BScroll(this.$refs.wrapper,{
      click:true,
      mouseWheel: true,
      observeDOM:true,
      probeType:this.probeType,
      pullUpLoad:this.pullUpLoad,
      observeImage:{
        debounceTime:200
      }
      })
      this.scroll.on('scroll',position => {
        // console.log(position);
        this.$emit('scroll',position)
      })
      // console.log(this.scroll);
      this.scroll.on('pullingUp',()=>{
        // console.log('上拉加载更多');
        this.$emit('pullingUp')
        // this.scroll.finishPullUp()
        
      })

      
  },
  updated() {
      
  }
};
</script>
<style  scoped>

</style>